package com.audaque.springboot.foshanupload.log.config;


import com.audaque.springboot.foshanupload.core.constants.ComConst;
import com.audaque.springboot.foshanupload.core.properties.StaticResourcePathProperties;
import com.audaque.springboot.foshanupload.log.interceptor.ControllerMdcHandlerInterceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.w3c.dom.stylesheets.LinkStyle;

import java.util.List;

/**
 * @author zgb
 * @desc ...
 * @date 2022-01-25 22:24:15
 */
@Configuration
public class LogWebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private StaticResourcePathProperties staticResourcePathProperties;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String > arr = staticResourcePathProperties.getList();
        registry.addInterceptor(new ControllerMdcHandlerInterceptor())
                .addPathPatterns(ComConst.INTERCEPTOR_ANY_MATCH)
                .excludePathPatterns(arr);


    }


}
